class Images{
    constructor(){
        this.proName = document.querySelector('#bread-pro-name')
        this.cart1=JSON.parse(localStorage.getItem('cart1'))
        this.ul = document.querySelectorAll('#box>.center>.left>ul>li>img')
        this.ol = document.querySelectorAll('#box>.center>.left>ol>li>img')
        this.ul1 = document.querySelectorAll('#box>.center>.box2>ul>li>img')
        this.h1 = document.querySelector('.right>h1')
        this.pic = document.querySelector('.right>.pic>.top>.price')
        this.txt = document.querySelector('.txt')
        this.List = JSON.parse(localStorage.getItem('cart'))
        this.span = document.querySelector('#sidebar>.head>a>.span')
        console.log(this.span)
        this.assignment()
        this.num()
    }
    assignment(){
        this.proName.innerHTML = this.cart1.skuName
        this.ul.forEach((item,index)=>{
            item.src = this.cart1.images[index].bigPic
        })
        this.ol.forEach((item,index)=>{
            item.src =this.cart1.images[index].smallPic
        })
        this.ul1.forEach((item,index)=>{
            item.src =this.cart1.images[index].hdPic
        })
        this.h1.innerHTML= this.cart1.brief
        this.pic.innerHTML = '￥'+this.cart1.marketPrice
        this.txt.value = this.cart1.cart_Num 
    }
    num(){
        var res = 0
        this.List.forEach(item=>{
            res += item.cart_Num
        })
        this.span.innerHTML = res
    }
}
new Images()





